﻿public static class GlobalMembersSkills_judo_master
{
	// ****************************************************************************
	// * Punch And Kick -- a simple 2D Fighting Game.
	// *
	// * Copyright (C) 2013 by
	// * Liu Chao
	// *
	// * This file is part of the Punch And Kick project, and may only be used,
	// * modified, and distributed under the terms of the GPLv2.
	// *
	// * (GPLv2 is abbreviation of GNU General Public License Version 2)
	// *
	// * By continuing to use, modify, or distribute this file you indicate that you
	// * have read the license and understand and accept it fully.
	// *
	// * The Punch And Kick project is distributed in the hope that it will be
	// * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 
	// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL v2 for
	// * more details.
	// *
	// * You should have received a copy of the GPLv2 along with this file. It is
	// * usually in the LICENSE.TXT file, If not, see <http://www.gnu.org/licenses/>.
	// * **************************************************************************

	// ****************************************************************************
	// * Punch And Kick -- 一个普通的2D格斗游戏
	// *
	// * 版权所有 (C) 2013 归属于
	// * 刘超
	// *
	// * 这个文件是 Punch And Kick 项目的一部分，并且只可以根据GPLv2许可协议来使用、
	// * 更改和发布。
	// *
	// * (GPLv2 是 GNU通用公共许可证第二版 的英文缩写)
	// *
	// * 继续使用、修改或发布本文件，表明您已经阅读并完全理解和接受这个许可协议。
	// *
	// * Punch And Kick 项目是基于技术交流目的而加以散布的，但不负任何担保责任，例
	// * 如：稳定性、可玩性、趣味性等的担保，甚至没有适销性或特定用途的隐含担保，详
	// * 情请参照GPLv2许可协议。
	// *
	// * 您应已收到附随于本文件的GPLv2许可协议的副本，它通常在LICENSE.TXT文件中，如果
	// * 没有，请查看：<http://www.gnu.org/licenses/>.
	// * **************************************************************************

	// 柔道家的技能



	//public static int AttackDamage_Judo(GamePlayer_ attacker, GamePlayer_ victim, int victim_state)
	//{
	//	double damage;
	//	damage = attacker.property.punch;
	//	damage += attacker.property.throw;
	//	return DamageReduce(victim, victim_state, (int)damage);
	//}

	//public static int AttackDamage_BackJudo(GamePlayer_ attacker, GamePlayer_ victim, int victim_state)
	//{
	//	double damage;
	//	damage = attacker.property.punch;
	//	damage += attacker.property.kick;
	//	damage /= 2.0;
	//	damage += attacker.property.throw;
	//	return DamageReduce(victim, victim_state, (int)damage);
	//}

	//public static LCUI_BOOL CanUseJudo(GamePlayer_ player)
	//{
	//	GamePlayer_ attacker;
	//	// 该技能不能给非格斗家的角色使用 
	//	if(player.type != (int)GamePlayerType.PLAYER_TYPE_JUDO_MASTER)
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	if (player.control.a_attack == 0)
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	attacker = GetTargetInCatchRange(player);
	//	if (attacker != null)
	//	{
	//		player.other = attacker;
	//		return DefineConstantsSkills_judo_master.TRUE;
	//	}
	//	if(player.state != (int)GamePlayerState.STATE_CATCH || !player.other)
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	// 对方需要是被擒住状态 
	//	if(player.other.state != (int)GamePlayerState.STATE_BE_CATCH)
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	// 需要是面对面 
	//	if(GamePlayer_IsLeftOriented(player) == GamePlayer_IsLeftOriented(player.other))
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	return DefineConstantsSkills_judo_master.TRUE;
	//}

	//public static LCUI_BOOL CanUseBackJudo(GamePlayer_ player)
	//{
	//	if(player.type != (int)GamePlayerType.PLAYER_TYPE_JUDO_MASTER)
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	if (player.control.a_attack == 0)
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	if(player.state != (int)GamePlayerState.STATE_CATCH || !player.other)
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	// 对方需要是背面被擒住状态 
	//	if(player.other.state != (int)GamePlayerState.STATE_BACK_BE_CATCH)
	//	{
	//		return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	// 需要是面朝同一方向 
	//	if(GamePlayer_IsLeftOriented(player) != GamePlayer_IsLeftOriented(player.other))
	//	{
	//			return DefineConstantsSkills_judo_master.FALSE;
	//	}
	//	return DefineConstantsSkills_judo_master.TRUE;
	//}

	//internal static void SelfAtSkillDone(LCUI_Widget_ widget)
	//{
	//	GamePlayer_ player;
	//	player = GameBattle_GetPlayerByWidget(widget);
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_UnlockMotion(player);
	//	GamePlayer_SetReady(player);
	//}

	//internal static void Judo_SetTargetLying(GamePlayer_ player)
	//{
	//	int ret;
	//	GamePlayer_UnlockAction(player);
	//	ret = GamePlayer_SetLying(player);
	//	GamePlayer_LockAction(player);
	//	GamePlayer_StopXMotion(player);
	//	if(ret == 0)
	//	{
	//		GamePlayer_SetRestTimeOut(player, 1000, GamePlayer_StartStand);
	//	}
	//}

	//internal static void AtTargetLanding(LCUI_Widget_ widget)
	//{
	//	GamePlayer_ player;
	//	player = GameBattle_GetPlayerByWidget(widget);
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_LYING_HIT);
	//	GameObject_AtActionDone(widget, (int)ActionType.ACTION_LYING_HIT, null);
	//	GamePlayer_LockAction(player);
	//	if(player.other)
	//	{
	//		Game_RecordAttack(player.other, DefineConstantsSkills_judo_master.ATK_JUDO, player, GamePlayerState.STATE_HIT_FLY_FALL);
	//		player.other.other = null;
	//	}
	//	player.other = null;
	//	GamePlayer_SetActionTimeOut(player, 200, Judo_SetTargetLying);
	//}

	//// 处理目标在被摔倒时与其它玩家的碰撞 
	//internal static void Judo_ProcTargetTouchAttack(LCUI_Widget_ self, LCUI_Widget_ other)
	//{
	//	GamePlayer_ player;
	//	GamePlayer_ other_player;

	//	player = GameBattle_GetPlayerByWidget(self);
	//	other_player = GameBattle_GetPlayerByWidget(other);
	//	if(player == null || other_player == null)
	//	{
	//		return;
	//	}
	//	if(other_player == player.other && other_player.state == (int)GamePlayerState.STATE_CATCH_SKILL_FA)
	//	{
	//		return;
	//	}
	//	if(player.state != (int)GamePlayerState.STATE_HIT_FLY_FALL)
	//	{
	//		GameObject_AtTouch(self, null);
	//		return;
	//	}
	//	// 如果已经是受攻击者了，则退出，不重复记录攻击 
	//	if (GameObject_HaveVictim(self, other) != null)
	//	{
	//		return;
	//	}
	//	// 设置自己的攻击类型 
	//	GamePlayer_SetAttackTypeName(player, DefineConstantsSkills_judo_master.ATK_JUMP_TREAD);
	//	// 添加受害者记录 
	//	GameObject_DirectAddVictim(self, other);
	//	// 重置对方的受攻击次数 
	//	other_player.n_attack = 0;
	//}

	//internal static void Judo_AtActionUpdate(LCUI_Widget_ widget)
	//{
	//	int z_index;
	//	double x;
	//	double z;
	//	double y;
	//	GamePlayer_ player;
	//	GamePlayer_ other_player;

	//	player = GameBattle_GetPlayerByWidget(widget);
	//	other_player = player.other;
	//	if (other_player == null)
	//	{
	//		return;
	//	}
	//	z_index = Widget_GetZIndex(player.object_);
	//	Widget_SetZIndex(other_player.object_, z_index-1);

	//	switch(GameObject_GetCurrentActionFrameNumber(widget))
	//	{
	//	case 1:
	//		x = GameObject_GetX(widget);
	//		y = GameObject_GetY(widget);
	//		z = GameObject_GetZ(widget);
	//		GameObject_SetX(other_player.object_, x);
	//		GameObject_SetY(other_player.object_, y);
	//		GameObject_SetZ(other_player.object_, z+40);
	//		if (GamePlayer_IsLeftOriented(player) != null)
	//		{
	//			GamePlayer_SetRightOriented(other_player);
	//		}
	//		else
	//		{
	//			GamePlayer_SetLeftOriented(other_player);
	//		}
	//		GamePlayer_UnlockAction(other_player);
	//		GamePlayer_ChangeState(other_player, GamePlayerState.STATE_TUMMY_HIT_FLY);
	//		GamePlayer_LockAction(other_player);
	//		break;
	//	case 2:
	//		x = GameObject_GetX(widget);
	//		y = GameObject_GetY(widget);
	//		z = GameObject_GetZ(widget);
	//		GamePlayer_UnlockAction(other_player);
	//		GamePlayer_ChangeState(other_player, GamePlayerState.STATE_HIT_FLY_FALL);
	//		if (GamePlayer_IsLeftOriented(player) != null)
	//		{
	//			GamePlayer_SetLeftOriented(other_player);
	//			x += 30;
	//		}
	//		else
	//		{
	//			GamePlayer_SetRightOriented(other_player);
	//			x -= 30;
	//		}
	//		GamePlayer_LockAction(other_player);
	//		GameObject_SetX(other_player.object_, x);
	//		GameObject_SetY(other_player.object_, y);
	//		GameObject_SetZ(other_player.object_, z);
	//		// 清除对方攻击记录，以让对方能够对其它角色造成新攻击 
	//		GameObject_ClearAttack(other_player.object_);
	//		GameObject_AtTouch(other_player.object_, Judo_ProcTargetTouchAttack);
	//		GameObject_AtLanding(other_player.object_, 0, -DefineConstantsSkills_judo_master.ZACC_JUMP, AtTargetLanding);
	//		break;
	//	case 4:
	//		break;
	//	default:
	//		break;
	//	}
	//}

	//public static void StartJudo(GamePlayer_ player)
	//{
	//	int z_index;
	//	if(!player.other)
	//	{
	//		return;
	//	}
	//	// 发动技能前，停止移动 
	//	GamePlayer_StopXMotion(player);
	//	GamePlayer_StopYMotion(player);
	//	// 对目标进行调整，使技能能够正常实现 
	//	CommonSkill_AdjustTargetAtBeCatch(player);

	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_UnlockAction(player.other);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_CATCH_SKILL_FA);
	//	GamePlayer_ChangeState(player.other, GamePlayerState.STATE_HIT);
	//	GamePlayer_LockAction(player.other);
	//	GamePlayer_LockAction(player);
	//	GamePlayer_LockMotion(player);

	//	GameObject_AtActionUpdate(player.object_, (int)ActionType.ACTION_CATCH_SKILL_FA, Judo_AtActionUpdate);
	//	GameObject_AtActionDone(player.object_, (int)ActionType.ACTION_CATCH_SKILL_FA, SelfAtSkillDone);
	//	z_index = Widget_GetZIndex(player.object_);
	//	Widget_SetZIndex(player.other.object_, z_index-1);
	//	player.other.n_attack = 0;
	//}

	//internal static void TargetStartLying(LCUI_Widget_ widget)
	//{
	//	int ret;
	//	GamePlayer_ player;

	//	player = GameBattle_GetPlayerByWidget(widget);
	//	if(player.other)
	//	{
	//		Game_RecordAttack(player.other, DefineConstantsSkills_judo_master.ATK_BACK_JUDO, player, GamePlayerState.STATE_HIT_FLY_FALL);
	//		player.other.other = null;
	//		GameObject_AtTouch(widget, null);
	//	}
	//	player.other = null;
	//	GamePlayer_UnlockAction(player);
	//	ret = GamePlayer_SetLying(player);
	//	GamePlayer_LockAction(player);
	//	GamePlayer_StopXMotion(player);
	//	if(ret == 0)
	//	{
	//		GamePlayer_SetRestTimeOut(player, 1000, GamePlayer_StartStand);
	//	}
	//}

	//internal static void ChangeTargetAction(LCUI_Widget_ widget)
	//{
	//	GamePlayer_ player;
	//	player = GameBattle_GetPlayerByWidget(widget);
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_HIT_FLY_FALL);
	//	GamePlayer_LockAction(player);
	//	GameObject_AtZSpeed(widget, -DefineConstantsSkills_judo_master.ZSPEED_JUDO_THROW/2, null);
	//}

	//// 处理目标在被扔飞后与其它玩家的碰撞 
	//internal static void BackJudo_ProcTargetTouchAttack(LCUI_Widget_ self, LCUI_Widget_ other)
	//{
	//	GamePlayer_ player;
	//	GamePlayer_ other_player;

	//	player = GameBattle_GetPlayerByWidget(self);
	//	other_player = GameBattle_GetPlayerByWidget(other);
	//	if(player == null || other_player == null)
	//	{
	//		return;
	//	}
	//	if(other_player == player.other && other_player.state == (int)GamePlayerState.STATE_CATCH_SKILL_BA)
	//	{
	//		return;
	//	}
	//	switch(player.state)
	//	{
	//	case GamePlayerState.STATE_HIT_FLY_FALL:
	//	case GamePlayerState.STATE_LYING_HIT:
	//		break;
	//	default:
	//		GameObject_AtTouch(self, null);
	//		return;
	//	}
	//	// 如果已经是受攻击者了，则退出，不重复记录攻击 
	//	if (GameObject_HaveVictim(self, other) != null)
	//	{
	//		return;
	//	}
	//	// 设置自己的攻击类型 
	//	GamePlayer_SetAttackTypeName(player, DefineConstantsSkills_judo_master.ATK_BUMPED);
	//	// 添加受害者记录 
	//	GameObject_DirectAddVictim(self, other);
	//	// 重置对方的受攻击次数 
	//	other_player.n_attack = 0;
	//}

	//internal static void BackJudo_AtActionUpdate(LCUI_Widget_ widget)
	//{
	//	int z_index;
	//	double x;
	//	double z;
	//	double x_speed;
	//	double x_acc;
	//	GamePlayer_ player;
	//	GamePlayer_ other_player;

	//	player = GameBattle_GetPlayerByWidget(widget);
	//	other_player = player.other;
	//	if (other_player == null)
	//	{
	//		return;
	//	}
	//	z_index = Widget_GetZIndex(player.object_);
	//	Widget_SetZIndex(other_player.object_, z_index-1);

	//	switch(GameObject_GetCurrentActionFrameNumber(widget))
	//	{
	//	case 1:
	//		GamePlayer_UnlockAction(other_player);
	//		GamePlayer_ChangeState(other_player, GamePlayerState.STATE_HIT_FLY);
	//		GamePlayer_LockAction(other_player);
	//		break;
	//	case 3:
	//		z = GameObject_GetZ(player.object_);
	//		x = GameObject_GetX(player.object_);
	//		GameObject_SetZ(other_player.object_, z+40);
	//		GameObject_SetX(other_player.object_, x);
	//		GamePlayer_UnlockAction(other_player);
	//		GamePlayer_ChangeState(other_player, GamePlayerState.STATE_LYING_HIT);
	//		GameObject_AtActionDone(other_player.object_, (int)ActionType.ACTION_LYING_HIT, null);
	//		GamePlayer_LockAction(other_player);
	//		x_speed = DefineConstantsSkills_judo_master.XSPEED_JUDO_THROW;
	//		x_acc = -DefineConstantsSkills_judo_master.XACC_JUDO_THROW;
	//		if (GamePlayer_IsLeftOriented(player) == null)
	//		{
	//			x_speed = 0 - x_speed;
	//			x_acc = 0 - x_acc;
	//		}
	//		GameObject_SetXSpeed(other_player.object_, x_speed);
	//		GameObject_SetXAcc(other_player.object_, x_acc);
	//		GameObject_AtZSpeed(other_player.object_, -DefineConstantsSkills_judo_master.ZSPEED_JUDO_THROW/2, ChangeTargetAction);
	//		GameObject_AtLanding(other_player.object_, DefineConstantsSkills_judo_master.ZSPEED_JUDO_THROW, -DefineConstantsSkills_judo_master.ZACC_JUDO_THROW, TargetStartLying);
	//		GameObject_ClearAttack(other_player.object_);
	//		GameObject_AtTouch(other_player.object_, BackJudo_ProcTargetTouchAttack);
	//		break;
	//	default:
	//		break;
	//	}
	//}

	//public static void StartBackJudo(GamePlayer_ player)
	//{
	//	int z_index;
	//	if(!player.other)
	//	{
	//		return;
	//	}
	//	// 发动技能前，停止移动 
	//	GamePlayer_StopXMotion(player);
	//	GamePlayer_StopYMotion(player);
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_CATCH_SKILL_BA);
	//	GamePlayer_LockAction(player);
	//	GamePlayer_LockMotion(player);

	//	GameObject_AtActionDone(player.object_, (int)ActionType.ACTION_CATCH_SKILL_BA, SelfAtSkillDone);
	//	GameObject_AtActionUpdate(player.object_, (int)ActionType.ACTION_CATCH_SKILL_BA, BackJudo_AtActionUpdate);

	//	z_index = Widget_GetZIndex(player.object_);
	//	Widget_SetZIndex(player.other.object_, z_index-1);
	//	player.other.n_attack = 0;
	//}

	////* 注册柔道家特有的技能 
	//public static void JudoMasterSkill_Register()
	//{
	//	SkillLibrary_AddSkill(DefineConstantsSkills_judo_master.SKILLNAME_JUDO, BattleState.SKILLPRIORITY_MACH_A_ATTACK, CanUseJudo, StartJudo);
	//	SkillLibrary_AddSkill(DefineConstantsSkills_judo_master.SKILLNAME_BACK_JUDO, BattleState.SKILLPRIORITY_MACH_A_ATTACK, CanUseBackJudo, StartBackJudo);
	//	AttackLibrary_AddAttack(DefineConstantsSkills_judo_master.ATK_JUDO, AttackDamage_Judo, null);
	//	AttackLibrary_AddAttack(DefineConstantsSkills_judo_master.ATK_BACK_JUDO, AttackDamage_BackJudo, null);
	//}
}
